home *** CD-ROM | disk | FTP | other *** search
/ Compute! Gazette 1986 July / 1986-07.d64 / seq file editor (.txt) < prev    next >
Commodore BASIC  |  2022-09-20  |  4KB  |  116 lines

  1. 10 z$=chr$(20):a=3000:ifpeek(56)<64thena=100
  2. 20 dima$(a):print"[147]"chr$(14)chr$(8);:open1,0,0:v=203:ifpeek(771)=164thenv=212
  3. 30 li$="[163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163]"
  4. 40 print"        [211]equential [198]ile [197]ditor":printli$""
  5. 50 print"[197]nter the name of the file you wish to  edit and press [210][197][212][213][210][206]"
  6. 60 print">";:input#1,fi$:print"":fi$=left$(fi$,16)
  7. 70 print"filename is "chr$(34)fi$chr$(34):print"[201]s this correct? (y/n) y[157]";
  8. 80 input#1,a$:print:iflen(a$)=0thenprint"[145]":goto80
  9. 90 a$=left$(a$,1):ifa$="y"thenprint:goto110
  10. 100 run
  11. 110 print"[196]isk [196]rive # (8-10) 8[157]";:input#1,a$:dr=int(val(a$))
  12. 120 ifdr<8ordr>10thenprint:printspc(22)"[145]       [145]":goto110
  13. 130 print"[147]  [210]eading "chr$(34)fi$chr$(34):printli$
  14. 140 f2$=fi$+",s,r":ln=1:print"  1 : ";
  15. 150 open8,dr,8,f2$:get#8,a$
  16. 160 ifst<>0thenprint"[198]ile [206]ot [198]ound":gosub1150:gosub1140:run
  17. 170 goto190
  18. 180 get#8,a$
  19. 190 ifa$<>chr$(13)thena$(ln)=a$(ln)+a$
  20. 200 ifst<>0thengosub1150:goto260
  21. 210 ifa$=chr$(13)then230
  22. 220 printa$;:goto180
  23. 230 b$="":ifln<9thenb$=" "
  24. 240 print:ln=ln+1:printb$;ln": ";:ifst<>0then260
  25. 250 goto180
  26. 260 close8:print"[147]"spc(13)"[205]ain [205]enu":printli$
  27. 270 print"[1] [204]ist [198]ile":print"[2] [197]dit [204]ine":print"[3] [201]nsert [204]ine"
  28. 280 print"[4] [196]elete [204]ine":print"[5] [210]e-[210]un [208]rogram"
  29. 290 print"[6] [210]e-[211]ave [198]ile after [197]diting":print"[7] [208]rint [198]ile to [208]rinter"
  30. 300 print"[8] [197]xit [208]rogram"
  31. 310 print"[197]nter your choice and press [210][197][212][213][210][206]"
  32. 320 print">";:input#1,a$:a=int(val(a$)):ifa<1ora>8then260
  33. 330 onagoto340,520,600,700,800,830,890,1000
  34. 340 print"[147]"spc(13)"[204]ist [198]ile":printli$
  35. 350 print"[208]ress ([193]) to abort or ([211][208][193][195][197]) to pause"
  36. 360 print"([215][146])ith or [215]ith([207][146])ut line numbers? w[157]";
  37. 370 input#1,a$:a$=left$(a$,1):ifa$<>"w"anda$<>"o"then370
  38. 380 print"":forr=1toln:ifa$="o"then410
  39. 390 b$="":ifr<10thenb$=" "
  40. 400 printb$;r": ";
  41. 410 printa$(r)
  42. 420 fort=1to100:next
  43. 430 getc$:ifc$=""thennext:goto490
  44. 440 ifc$="a"thenprint:print"* [193]borted *":goto490
  45. 450 ifc$<>" "then430
  46. 460 print"* [208]aused *"
  47. 470 getc$:ifc$=""then470
  48. 480 print"[145]           ":print"[145]";:goto430
  49. 490 print"  [208]ress any key for [205]ain [205]enu"
  50. 500 getc$:ifc$=""then500
  51. 510 goto260
  52. 520 print"[147]"spc(13)"[197]dit [204]ine":printli$:print"[215]hich line number to edit? ";
  53. 530 input#1,a$:a=int(val(a$)):print
  54. 540 ifa>0anda<=lnthen560
  55. 550 print"[194]ad line number":gosub1150:goto520
  56. 560 print" "a$(a):print"[210]etype line or press [210][197][212][213][210][206]"
  57. 570 print">";:gosub1040:print
  58. 580 ift$=chr$(13)andp=0thenprint"[213]n-changed":gosub1150:goto260
  59. 590 print"[195]hanged":gosub1150:a$(a)=a$:goto260
  60. 600 print"[147]"spc(13)"[201]nsert a line":printli$
  61. 610 print"[215]here should the line be inserted?"
  62. 620 print">";:input#1,a$:a=int(val(a$)):print
  63. 630 ifa>0anda<=lnthen650
  64. 640 print:print"[194]ad line number":gosub1150:goto600
  65. 650 print"[215]hat would you like that line to be?    (press [210][197][212][213][210][206] to abort)"
  66. 660 print">";:gosub1040
  67. 670 ift$=chr$(13)andp=0then260
  68. 680 forr=lntoastep-1:a$(r+1)=a$(r):next:ln=ln+1
  69. 690 print:print"[196]one":gosub1150:a$(a)=a$:goto260
  70. 700 print"[147]"spc(13)"[196]elete [204]ine":printli$
  71. 710 print"[215]hich line would you like to delete?"
  72. 720 print">";:input#1,a$:a=int(val(a$))
  73. 730 ifa<1ora>lnthen700
  74. 740 print:print:printa$(a):print"[196]elete this line (y/n)? y[157]";
  75. 750 input#1,a$:a$=left$(a$,1):print
  76. 760 ifa$="y"then780
  77. 770 print"[206]ot [196]eleted":gosub1150:goto260
  78. 780 forr=atoln:a$(r)=a$(r+1):next:ln=ln-1:print"[196]eleted"
  79. 790 gosub1150:goto260
  80. 800 print:print"[193]re you sure (y/n)? y[157]";:input#1,a$:a$=left$(a$,1)
  81. 810 ifa$="y"thenrun
  82. 820 goto260
  83. 830 print"[147]"spc(12)"[210]e-[211]ave [198]ile":printli$
  84. 840 print"[197]nter the file name":print"('*' for same name as before)"
  85. 850 f3$=fi$:print">";:input#1,a$:ifa$<>"*"thenf3$=a$
  86. 860 open15,dr,15,"s0:"+f3$:close15:f4$="0:"+f3$+",s,w":open8,dr,8,f4$
  87. 870 print"":forr=1toln:print"[204]ine: "r"[145]":print#8,a$(r):next
  88. 880 close8:print:print:print"[196]one":gosub1150:goto260
  89. 890 print"[147]"spc(13)"[208]rinting [198]ile":printli$
  90. 900 print"[200]ow many lines per page does your paper"
  91. 910 print"have? (0 = [195]ontinuous printing)"
  92. 920 print">";:input#1,lp:ll=0:iflp<0orlp<>int(lp)then890
  93. 930 print:print:print"[208]ress ([211]pace) to print or '[193]' to abort"
  94. 940 geta$:ifa$="a"then260
  95. 950 ifa$=" "then970
  96. 960 goto940
  97. 970 open9,4,7:forr=1to5:print#9:next:forr=1toln:print#9,a$(r)
  98. 980 ll=ll+1:ifll=lp-10thenfort=1to10:print#9:next:ll=0
  99. 990 next:print#9:close9:goto260
  100. 1000 print:print"[193]re you sure (y/n)? y[157]";
  101. 1010 input#1,a$:a$=left$(a$,1):ifa$="y"thenprint"[147]":end
  102. 1020 goto260
  103. 1030 rem return as a$
  104. 1040 p=0:a$=""
  105. 1050 printchr$(166)chr$(157);
  106. 1060 gett$:ift$=""or(t$=chr$(24)anda$="")then1060
  107. 1070 print" "chr$(157);
  108. 1080 ift$=z$andlen(a$)>0thena$=left$(a$,len(a$)-1):printt$;:p=p-1:goto1050
  109. 1090 ift$=chr$(24)thenforz=1tolen(a$):printz$;:next:goto1040
  110. 1100 ift$=chr$(13)thenprintt$:return
  111. 1110 if(asc(t$)and127)<32then1050
  112. 1120 ifp>253then1050
  113. 1130 printt$;:a$=a$+t$:pokev,0:p=p+1:goto1050
  114. 1140 open15,8,15:input#15,a$,b$,c$,d$:close15:return
  115. 1150 forr=1to1000:next:return
  116.